//
//  HMComposeVC.m
//  SinaWeiBo
//
//  Created by WGP on 16/4/28.
//  Copyright © 2016年 WGP. All rights reserved.
//

#import "HMComposeVC.h"

@interface HMComposeVC ()

@end

@implementation HMComposeVC

- (void)viewDidLoad {
    [super viewDidLoad];
    
    self.view.backgroundColor = [UIColor whiteColor];
    self.navigationController.navigationBar.tintColor = [UIColor orangeColor];
    [self setupUI];
}

-(void)setupUI
{
    self.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc] initWithTitle:@"取消" style: UIBarButtonItemStylePlain target:self action:@selector(cancel)];
    self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc] initWithTitle:@"发送" style:UIBarButtonItemStylePlain target:self action:@selector(send)];
    self.navigationItem.rightBarButtonItem.enabled = NO;

    UILabel *titleView = [[UILabel alloc] init];
    titleView.numberOfLines = 0;
    titleView.textAlignment = NSTextAlignmentCenter;
    titleView.textColor = [UIColor blackColor];
    titleView.font = HMWelcomeLabelFont;
    
    NSString *name = [HMUserAccountViewModel sharedInstance].userAccount.screen_name;
    NSString *title = [NSString stringWithFormat:@"发微博\n%@",name];
    NSRange range = [title rangeOfString:name];
    NSMutableAttributedString *attStr = [[NSMutableAttributedString alloc] initWithString:title];
    [attStr addAttribute:NSFontAttributeName value:[UIFont systemFontOfSize:12] range:range];
    [attStr addAttribute:NSForegroundColorAttributeName value:[UIColor lightGrayColor] range:range];
    
    titleView.attributedText = attStr;
    [titleView sizeToFit];
    self.navigationItem.titleView = titleView;
}

-(void)cancel
{
    [self dismissViewControllerAnimated:YES completion:nil];
}

-(void)send
{
    
}

@end
